// @ts-ignore
/* eslint-disable */

import { request, type RequestOptions } from '@/utils/request';

/**
 * 配置规则
 * @param input 规则输入
 * @returns
 */
export async function configRule(input: RuleInput, options?: RequestOptions) {
  return request<RuleOut>(`appinfo/config-rule`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取合同列表
 * @param input 合同搜索参数
 * @returns
 */
export async function contracts(input: ContractSearch, options?: RequestOptions) {
  return request<ContractListOut>(`appinfo/contracts`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取数据字典
 * @returns
 */
export async function dic(options?: RequestOptions) {
  return request<AppDicOut[]>(`appinfo/dic`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 获取规则
 * @returns
 */
export async function rule(options?: RequestOptions) {
  return request<RuleOut>(`appinfo/rule`, {
    method: 'GET',
    ...(options || {}),
  });
}

/**
 * 创建合同
 * @param input 合同输入参数
 * @returns
 */
export async function contract(input: ContractInput, options?: RequestOptions) {
  return request<Boolean>(`appinfo/contract`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取通知列表
 * @param input 通知搜索参数
 * @returns
 */
export async function notices(input: NoticeSearch, options?: RequestOptions) {
  return request<NoticeListOut>(`appinfo/notices`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 创建/更新通知
 * @param input 通知参数
 * @returns
 */
export async function notice(input: NoticeOut, options?: RequestOptions) {
  return request<string>(`appinfo/notice`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取微信通知列表
 * @param input 微信通知搜索参数
 * @returns
 */
export async function wxNotices(input: NoticeWxSearch, options?: RequestOptions) {
  return request<NoticeListOut>(`appinfo/wx-notices`, {
    method: 'POST',
    data: input,
    ...(options || {}),
  });
}

/**
 * 获取指定分组的数据字典
 * @param group 分组名称
 * @returns
 */
export async function dicGroup(group: string, options?: RequestOptions) {
  return request<AppDicOut[]>(`appinfo/dic-group`, {
    method: 'GET',
    params: { 'group': group },
    ...(options || {}),
  });
}
